package com.audaque.springboot.foshanupload.web.emaildemo.controller;

import com.audaque.springboot.foshanupload.email.component.EmailProvider;
import com.audaque.springboot.foshanupload.web.emaildemo.req.EmailReq;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;

import javax.mail.MessagingException;

/**
 * @author zgb
 * @desc ...
 * @date 2023-04-26 09:18:27
 */
@Slf4j
@RestController
@RequestMapping("/email")
public class EmailController {
    @Autowired
    private EmailProvider emailProvider;



    @SneakyThrows
    @PostMapping("/sendMimeMessage")
    public void sendMimeMessage(
            @RequestParam("file") MultipartFile file,
            @RequestParam("title") String title,
            @RequestParam("content") String content,
            @RequestParam("mailingList") String[]  mailingList,
            @RequestParam("ccArr") String[]  ccArr) throws MessagingException {
        //发送
        emailProvider.sendMimeMessage(title,content, mailingList, file,ccArr);
    }
}
